
app:registClass("NewguildController", "app.newGuild.controllers.NewguildController")
app:registClass("NewguildPreController", "app.newGuild.controllers.NewguildPreController")

local NewguildModel = import(".models.NewguildModel")
app:registInst(NewguildModel.new())

app:registInst(app:getClass("NewguildPreController").new({type="systemUI"}))
app:registInst(app:getClass("NewguildController").new({type="systemUI"}))

local model = app:getInst("NewguildModel")
------------------------------------------------>>>>>> 公会相关协议
-- 我的公会信息更新、登录时候会推给我
app.session:on("pb_guild.S2C_MyGuildInfo",function(ret)
	--dump( ret, " ------------------->>>> S2C_MyGuildInfo" )
	model:onMyGuildInfoUpdate(ret)
end)

-- guildInfo Update
app.session:on("pb_guild.S2C_GuildInfoUpdate",function(ret)
	--dump( ret, " ------------------->>>> S2C_GuildInfoUpdate" )
	model:setMyGuildInfo(ret.guildInfo)
end)

-- 成员信息更新
app.session:on("pb_guild.S2C_GuildMemberInfoUpdate",function(ret)
	-- dump( ret, " ------------------->>>> S2C_GuildMemberInfoUpdate" )
	model:onGuildMemberUpdate(ret)
end)

-- 公会挑战信息更新
app.session:on("pb_guild.S2C_GuildChallengeList",function(ret)
	-- dump( ret, " ------------------->>>> S2C_GuildChallengeList" )
	model:onGuildChallengeInfoUpdate(ret.infos)
end)

-- 有新申请者消息
app.session:on("pb_guild.S2C_GuildApplyTipsUpdate",function(ret)
	-- dump( ret, " ------------------->>>> S2C_GuildApplyTipsUpdate" )
	model:onGuildNewApplicant( ret.applyTips )
end)

-- 公会经验值增加通知
app.session:on("pb_guild.S2C_GuildExpAddNotify",function(ret)
	-- dump( ret, " ------------------->>>> S2C_GuildExpAddNotify" )
	model:onGuildExpAdded( ret.addExp )
end)

-- 邀请入会，通知被邀请者
app.session:on("pb_guild.S2C_GuildInvitePlaneInfo", function(ret)
	--print("S2C_GuildInvitePlaneInfo")
	model:onGuildInvitePlaneInfo(ret)
end)

--公会的领地信息更新
app.session:on("pb_guild.TerritoryInfoNotify", function(ret)
	--dump(ret,"TerritoryInfoNotify")
	model:onGuildUpdateTerritoryInfo(ret)
end)

--会长爵位变动
app.session:on("pb_guild.S2C_LeaderTitleChangeNotify", function(ret)
	--dump(ret,"S2C_LeaderTitleChangeNotify")
	model:addDynastyPromoteTips(ret.titleId)
end)

--势力的光辉历史
app.session:on("pb_gloryhistory.S2C_HistoryEventNotify", function(ret)
	--dump(ret,"S2C_HistoryEventNotify")
	for k,v in ipairs(ret.events) do
		--dump(v)
		model:addDynastyHistoryTips(v)
	end
end)